'\" te
.\"  Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH KVM_KREAD 3KVM "May 2, 2002"
.SH NAME
kvm_kread, kvm_kwrite, kvm_uread, kvm_uwrite \- copy data to or from a kernel
image or running system
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lkvm\fR [ \fIlibrary\fR\&.\|.\|.]
#include <kvm.h>

\fBssize_t\fR \fBkvm_kread\fR(\fBkvm_t *\fR\fIkd\fR, \fBuintptr_t\fR \fIaddr\fR, \fBvoid *\fR\fIbuf\fR, \fBsize_t\fR \fInbytes\fR);
.fi

.LP
.nf
\fBssize_t\fR \fBkvm_kwrite\fR(\fBkvm_t *\fR\fIkd\fR, \fBuintptr_t\fR \fIaddr\fR, \fBvoid *\fR\fIbuf\fR, \fBsize_t\fR \fInbytes\fR);
.fi

.LP
.nf
\fBssize_t\fR \fBkvm_uread\fR(\fBkvm_t\fR \fI*kd\fR, \fBuintptr_t\fR \fIaddr\fR, \fBvoid *\fR\fIbuf\fR, \fBsize_t\fR \fInbytes\fR);
.fi

.LP
.nf
\fBssize_t\fR \fBkvm_uwrite\fR(\fBkvm_t *\fR\fIkd\fR, \fBuintptr_t\fR \fIaddr\fR, \fBvoid *\fR\fIbuf\fR, \fBsize_t\fR \fInbytes\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBkvm_kread()\fR function transfers data from the kernel address space to
the address space of the process. \fInbytes\fR bytes of data are copied from
the kernel virtual address given by \fIaddr\fR to the buffer pointed to by
\fIbuf\fR.
.sp
.LP
The \fBkvm_kwrite()\fR function is like \fBkvm_kread()\fR, except that the
direction of the transfer is reversed. To use this function, the
\fBkvm_open\fR(3KVM) call that returned  \fIkd\fR must have specified write
access.
.sp
.LP
The \fBkvm_uread()\fR function transfers data from the address space of the
processes specified in the most recent  \fBkvm_getu\fR(3KVM) call. \fInbytes\fR
bytes of data are copied from the user virtual address given by \fIaddr\fR to
the buffer pointed to by \fIbuf\fR.
.sp
.LP
The \fBkvm_uwrite()\fR function is like \fBkvm_uread()\fR, except that the
direction of the transfer is reversed. To use this function, the
\fBkvm_open\fR(3KVM) call that returned \fIkd\fR must have specified write
access. The address is resolved in the address space of the process specified
in the most recent \fBkvm_getu\fR(3KVM) call.
.SH RETURN VALUES
.sp
.LP
On success, these functions return the number of bytes actually transferred. On
failure, they return \(mi1.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Stable
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.sp
.LP
.BR kvm_getu (3KVM),
.BR kvm_nlist (3KVM),
.BR kvm_open (3KVM),
.BR attributes (7)
